﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using ClosedXML.Excel;

#endregion

namespace ScrumTable.Common.Excel.OpenXmlSdk.Extensions
{
    /// <summary>
    /// Provides the additional functionalities required for Excel
    /// data management of a IXLRow instance.
    /// </summary>
    public static class XLRowUtil
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Determines whether the specified data row is empty which means that
        /// all values of the given DataRow contain empty data value instances.
        /// </summary>
        public static bool AccommodatesValues(this IXLRow thisPtr)
        {
            PreCondition.AssertNotNull(thisPtr, "thisPtr");

            foreach (IXLCell value in thisPtr.Cells())
            {
                if (value.AccommodatesValue())
                {
                    return true;
                }
            }
            return false;
        }

        #endregion
    }
}